package org.liliya;

import cn.hutool.core.net.NetUtil;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;

/**
 * @author liliya
 * @date 2021/4/28 14:55
 */
@SpringBootApplication
@EnableEurekaClient
@EnableDiscoveryClient
@EnableZuulProxy
public class ProductServiceZuulApplication {
    public static void main(String[] args) {
        int port = 9000;
        //如果9000端口不可用
        if (!NetUtil.isUsableLocalPort(port)){
            System.out.printf("端口%d被占用了，无法启动",port);
            System.exit(1);
        }
        new SpringApplicationBuilder(ProductServiceZuulApplication.class).properties("server.port="+port).run(args);
    }
}
